package com.situ.day10;

import org.junit.Test;

public class EnumDemo {
    public static void main(String[] args) {
        Color color = Color.RED;
        System.out.println(color);
    }

    @Test
    public void test1() {
        System.out.println(Color.RED.getHexCode());
    }

    @Test
    public void test2() {
        //遍历所有的枚举值
        for (Season season : Season.values()) {
            System.out.println(season);
            System.out.println(season.getName() + " : " + season.getDesciption());
        }
    }

    @Test
    public void test3() {
        Color color = Color.BLUE;
        switch (color) {
            case RED:
                System.out.println("这是红色");
                break;
            case GREEN:
                System.out.println("这是绿色");
                break;
            case BLUE:
                System.out.println("这是蓝色");
                break;
            default:
                System.out.println("未知颜色");
        }
    }
}
